﻿<%@ Page Language="C#" %>
<%@ Import Namespace="IRL.Utilities" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">            
    public const int CURRENT_MODULE = 53;
    
    SummaryData proposalSummary, projectSummary;
    int selectedYear;
    int market = 0;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        Security SysAcc = new Security(CURRENT_MODULE);
        // check is authenticate
        SysAcc.Authenticate();
        
        // load reminder count
        //Mics.loadReminderCount(lblReminderCount);
        
        proposalSummary = new SummaryData();
        projectSummary = new SummaryData();

        if (Page.Cache["year"] == null)
        {
            selectedYear = DateTime.Today.Year;
        }
        else
        {
            selectedYear = Convert.ToInt32(Page.Cache["year"].ToString());
        }
        
        if (Request.Cookies["office"] != null)
        {
            market = Convert.ToInt32(Request.Cookies["office"].Value);
        }
        else
        {
            if (Page.Cache["market"] == null)
            {
                market = 1;
            }
            else
            {
                market = Convert.ToInt32(Page.Cache["market"].ToString());
            }
        }
        loadData();
        
        //if (!Page.IsPostBack)
        //{
            bind_Proposals();
            bind_Projects();
        //}
    }

    void loadData()
    {
        if (Request.Cookies["office"] != null)
        {
            optMarket.Visible = false;
        }
        else
        {
            if (optMarket.SelectedValue != "")
                market = Convert.ToInt32(optMarket.SelectedValue);
            object connStr = ConfigurationSettings.AppSettings["sqlConn"];
            using (SqlConnection conn = new SqlConnection(connStr.ToString()))
            {
                SqlCommand cmd = new SqlCommand("SELECT [id], [Name] FROM tbl_IRLs;", conn);
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                optMarket.DataTextField = "Name";
                optMarket.DataValueField = "id";
                // bind to control
                optMarket.DataSource = dr;
                optMarket.DataBind();
                // set default
                optMarket.SelectedValue = market.ToString();
            }
        }
        // year
        if (cboYear.SelectedValue != "")
            selectedYear = Convert.ToInt32(cboYear.SelectedValue);
        if (cboYear.Items.Count == 0)
        {
            for (int i = DateTime.Today.Year; i >= 2000; i--)
            {
                cboYear.Items.Add(i.ToString());
            }
        }
        cboYear.SelectedValue = selectedYear.ToString();
    }
    void bind_Proposals()
    {
        object connStr = ConfigurationSettings.AppSettings["sqlConn"];
        using (SqlConnection conn = new SqlConnection(connStr.ToString()))
        {
            SqlCommand cmd = new SqlCommand("sp_Ops_Proposals", conn);            
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@market", SqlDbType.Int).Value = market;
            cmd.Parameters.Add("@year", SqlDbType.Int).Value = selectedYear;
            conn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            rptProposals.DataSource = dr;
            rptProposals.DataBind();
            // calculate countAll
            proposalSummary.countAll = rptProposals.Items.Count;
        }
    }

    void bind_Projects()
    {
        object connStr = ConfigurationSettings.AppSettings["sqlConn"];
        using (SqlConnection conn = new SqlConnection(connStr.ToString()))
        {            
            SqlCommand cmd = new SqlCommand("sp_Ops_Projects", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@market", SqlDbType.Int).Value = market;
            cmd.Parameters.Add("@year", SqlDbType.Int).Value = selectedYear;
            conn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            rptProjects.DataSource = dr;
            rptProjects.DataBind();
            // calculate countAll
            projectSummary.countAll = rptProjects.Items.Count;
        }
    }
    
    string render_rptProposals(RepeaterItem r)
    {
        StringBuilder strHTML = new StringBuilder(255);
        string dateCreated = String.Format("{0:dd-MMM}", DataBinder.Eval(r.DataItem, "DateCreated"));
        string clientName = DataBinder.Eval(r.DataItem, "Company_Name").ToString();
        string projectName = DataBinder.Eval(r.DataItem, "ProjectName").ToString();
        string costs = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Costs"));
        int projectType = Convert.ToInt32(DataBinder.Eval(r.DataItem, "ProjectType"));
        string cont = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Cont"));
        string adhoc = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Adhoc"));
        int researchCat = Convert.ToInt32(DataBinder.Eval(r.DataItem, "ResearchCategory"));
        string sr = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "SR"));
        string cr = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "CR"));
        string stat = DataBinder.Eval(r.DataItem, "Status").ToString();

        strHTML.Append("<tr");
        switch (stat)
        {
            case "Commissioned Already":
                strHTML.Append(" bgColor=\"LemonChiffon\" ");
                break;
            case "Not Commissioned":
                strHTML.Append(" bgColor=\"Crimson\" ");
                break;
            default:
                break;
        }
        strHTML.Append(" style=\"cursor:default\" >");
        //strHTML.Append(" style=\"cursor:default\" onmouseover=\"highlight(this)\" onmouseout=\"clearHighlight(this)\">");
        strHTML.Append("<td align=\"center\">"+ (r.ItemIndex+1) +"</td>");
        strHTML.Append("<td align=\"center\" nowrap>" + dateCreated + "</td>");
        strHTML.Append("<td nowrap>"+ clientName +"</td>");
        strHTML.Append("<td nowrap>" + projectName + "</td>");
        strHTML.Append("<td align=\"center\">" + costs + "</td>");
        if (projectType == 1)
        {
            strHTML.Append("<td align=\"center\">CON</td>");
        }
        else
        {
            strHTML.Append("<td align=\"center\">AH</td>");
        }
        strHTML.Append("<td align=\"center\">" + cont + "</td>");
        strHTML.Append("<td align=\"center\">" + adhoc + "</td>");
        if (researchCat == 1)
        {
            strHTML.Append("<td align=\"center\">CR</td>");
        }
        else
        {
            strHTML.Append("<td align=\"center\">SR</td>");
        }
        strHTML.Append("<td align=\"center\">" + sr + "</td>");
        strHTML.Append("<td align=\"center\">" + cr + "</td>");
        //if (stat == "Commissioned Already")
        //{
        //    strHTML.Append("<td align=\"center\"><img src=\"images/tickicon.gif\" title=\"Commissioned Already\" /></td>");
        //}
        //else if(stat == "Not Commissioned")
        //{
        //    strHTML.Append("<td align=\"center\"><img src=\"images/banicon.gif\" title=\"Not Commissioned\" /></td>");
        //}            
        //else
        //{
        //    strHTML.Append("<td>&nbsp;</td>");
        //}
        strHTML.Append("</tr>");
        return strHTML.ToString();
    }

    string render_rptProjects(RepeaterItem r)
    {
        StringBuilder strHTML = new StringBuilder(255);        
        string clientName = DataBinder.Eval(r.DataItem, "Company_Name").ToString();
        string projectName = DataBinder.Eval(r.DataItem, "ProjectName").ToString();
        string projectCode = DataBinder.Eval(r.DataItem, "ProjectCode").ToString();
        string costs = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Costs"));
        int projectType = Convert.ToInt32(DataBinder.Eval(r.DataItem, "ProjectType"));
        string cont = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Cont"));
        string adhoc = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "Adhoc"));
        int researchCat = Convert.ToInt32(DataBinder.Eval(r.DataItem, "ResearchCategory"));
        string sr = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "SR"));
        string cr = String.Format("{0:#,##0}", DataBinder.Eval(r.DataItem, "CR"));

        strHTML.Append("<tr style=\"cursor:default\" onmouseover=\"highlight(this)\" onmouseout=\"clearHighlight(this)\">");
        strHTML.Append("<td align=\"center\">" + (r.ItemIndex + 1) + "</td>");        
        strHTML.Append("<td nowrap>" + clientName + "</td>");
        strHTML.Append("<td nowrap>" + projectName + "</td>");
        strHTML.Append("<td align=\"center\">" + costs + "</td>");
        strHTML.Append("<td align=\"center\">" + projectCode + "</td>");
        if (projectType == 1)
        {
            strHTML.Append("<td align=\"center\">CON</td>");
        }
        else
        {
            strHTML.Append("<td align=\"center\">AH</td>");
        }
        strHTML.Append("<td align=\"center\">" + cont + "</td>");
        strHTML.Append("<td align=\"center\">" + adhoc + "</td>");
        if (researchCat == 1)
        {
            strHTML.Append("<td align=\"center\">CR</td>");
        }
        else
        {
            strHTML.Append("<td align=\"center\">SR</td>");
        }
        strHTML.Append("<td align=\"center\">" + sr + "</td>");
        strHTML.Append("<td align=\"center\">" + cr + "</td>");
        strHTML.Append("</tr>");
        return strHTML.ToString();
    }
    
    protected void rptProposals_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            double cost = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "Costs"));
            double cont = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "Cont"));
            double adhoc = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "Adhoc"));
            double SR = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "SR"));
            double CR = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "CR"));
            SummaryData summary;
            if (((Repeater)sender).ID == "rptProposals")
            {
                summary = proposalSummary;
            }
            else
            {
                summary = projectSummary;
            }
            summary.totalCosts += cost;
            summary.totalCont += cont;
            summary.totalAdhoc += adhoc;
            summary.totalSR += SR;
            summary.totalCR += CR;
            if (cont > 0)
                summary.countCont++;
            if (adhoc > 0)
                summary.countAdhoc++;
            if (SR > 0)
                summary.countSR++;
            if (CR > 0)
                summary.countCR++;
        }
    }

    protected void optMarket_SelectedIndexChanged(object sender, EventArgs e)
    {
        market = Convert.ToInt32(optMarket.SelectedValue);
        Page.Cache["market"] = market;
    }

    string GetMarketName(int id)
    {
        string __value = "";
        object connStr = ConfigurationSettings.AppSettings["sqlConn"];
        using (SqlConnection conn = new SqlConnection(connStr.ToString()))
        {
            SqlCommand cmd = new SqlCommand("SELECT [Name] FROM tbl_IRLs WHERE [id]=" + id, conn);
            conn.Open();
            try
            {
                __value = (string)cmd.ExecuteScalar();
            }
            catch (Exception e) { __value = ""; }
        }
        return __value;
    }

    string DivisionOf(double x, double y, string format)
    {
        double result;
        if (y == 0)
        {
            result = 0;
        }
        else
        {
            result = x / y;
        }
        return String.Format("{0:" + format + "}", result);
    }

    class SummaryData
    {
        public double totalCosts, totalCont, totalAdhoc, totalSR, totalCR;
        public int countAll, countCont, countAdhoc, countSR, countCR;
        public int currentMonth;

        public SummaryData()
        {
            totalCosts = 0;
            totalCont = 0;
            totalAdhoc = 0;
            totalSR = 0;
            totalCR = 0;
            countAll = 0;
            countCont = 0;
            countAdhoc = 0;
            countSR = 0;
            countCR = 0;
            currentMonth = DateTime.Today.Month;
        }

        public double MthAv
        {
            get
            {
                return (totalCR + totalSR) / currentMonth;
            }
        }
    }


    protected void cboYear_SelectedIndexChanged(object sender, EventArgs e)
    {
        selectedYear = Convert.ToInt32(cboYear.SelectedValue);
        Page.Cache["year"] = selectedYear;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title>Indochina Research</title>
    <link type="text/css" rel="stylesheet" href="../css/global.css" />
    <link type="text/css" rel="stylesheet" href="css/cms.css" />
    
    <style type="text/css">
        .headerGray td {
            font-size:7.5pt;
            font-weight:bold;
            color:#ffffff;
        }
    </style>
    <script language="javascript">
        
        function highlight(o)
        {
            var c = "#FDEFCE";//"#EFEFEF";
            setBackground(o, c);
        }
        function clearHighlight(o)
        {
            var c = "";
            setBackground(o, c);
        }
        function toggleFocus(o)
        {
            if(o!=null)
            {
                var c = "";
                if(o.attributes["nochange"]==null)
                {
                    highlight(o);
                    o.setAttribute("nochange", "on");
                }
                else
                {
                    o.removeAttribute("nochange");
                    clearHighlight(o);
                }
                
            }
        }
        function setBackground(o, c)
        {
            if(o!=null)
            {
                if(o.attributes["nochange"]==null)
                {
                    o.style.backgroundColor = c;
                }
            }
        }
    </script>

</head>

<body>
<table width="773" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td width="765" height="540" align="center" valign="top" style="border:solid 1px #10147e;" >
			<!-- header -->
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr bgcolor="#F4F4F9">
					<td colspan="3" align="right" style="padding:10px;">
						<b class="blueL">Client Management System</b>
					</td>
				</tr>
				<tr>
					<td class="wave_l">&nbsp;</td>
					<td><img src="images/wave_logo.jpg" width="107" height="83"></td>
					<td class="wave_r">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="3" style="padding:0 20px;">
						<div style="background-color:#bcb3d5; padding:5px 10px;">
							<span style="float:right">
							    <a class="blue" href="javascript:history.go(-1);">&laquo; Back</a>
							</span>
							<span class="pathmap">
								<a href="default.aspx" >CPanel</a> :: 
								<a href="default2.aspx" >Ops Files</a> :: 
								Proposals &amp; Confirmed Projects (Details)
						    </span>
						</div>
						<br />
						
						
					</td>
				</tr>
				
			</table>
			
			<!-- body -->			
			<form id="DataForm" method="post" runat="server">
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td align="left" valign="top" style="padding:0 20px;">
						<div style="width:725px; overflow:auto; overflow-y:visible;">
						<table border="0" cellspacing="0" cellpadding="0">
						    <tr>
						        <td>
						            <div>Year: <asp:DropDownList ID="cboYear" AutoPostBack="true" runat="server" OnSelectedIndexChanged="cboYear_SelectedIndexChanged" /></div>
						            <div><asp:RadioButtonList ID="optMarket" RepeatColumns="4" RepeatLayout="table" CellPadding="8" CellSpacing="0" runat="server" AutoPostBack="true" OnSelectedIndexChanged="optMarket_SelectedIndexChanged" /></div>
						            
						            <h3><%=GetMarketName(market) %> <%=selectedYear %> Proposals &amp; Confirmed Projects</h3><br clear="all" />
						            <span><a class="edit" href="ops_Summary.aspx">&raquo; View Summary</a></span></td>
						        <td width="50">&nbsp;</td>
						        <td valign="top">
						            <table border="0">
						                <tr>
						                    <td><img class="ind" src="images/LemonChiffon.gif" width="45" height="15" /></td>
						                    <td>&nbsp;</td>
						                    <td>Commissioned Already</td>
						                </tr>
						                <tr>
						                    <td><img class="ind" src="images/FFFFFF.gif" width="45" height="15" /></td>
						                    <td>&nbsp;</td>
						                    <td>Not Confirmed</td>
						                </tr>
						                <tr>
						                    <td><img class="ind" src="images/Crimson.gif" width="45" height="15" /></td>
						                    <td>&nbsp;</td>
						                    <td>Not Commissioned</td>
						                </tr>
						            </table>
						        </td>
						    </tr>
						</table><br clear="all" />
						<table border="0">
                            <tr>
                                <td valign="top">
                                    <asp:Repeater ID="rptProposals" runat="server" OnItemDataBound="rptProposals_ItemDataBound">
                                        <HeaderTemplate>
                                            <table class="data" border="0" cellspacing="0" cellpadding="5" style="height: 100%">
                                                <tr>
                                                    <td colspan="11"><b class="fldNote">Proposals</b></td>
                                                </tr>
                                                <tr class="header">
                                                    <td align="center">No</td>
                                                    <td>Date</td>
                                                    <td>Client Name</td>
                                                    <td>Job Name</td>
                                                    <td align="center" >Value</td>
                                                    <td>Type</td>
                                                    <td align="center">Cont</td>
                                                    <td align="center">Adhoc</td>
                                                    <td>Type</td>
                                                    <td align="center">SR</td>
                                                    <td align="center">CR</td>
                                                    <!--<td align="center">Status</td>-->
                                                </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# render_rptProposals((RepeaterItem)Container) %>
                                        </ItemTemplate>
                                        <SeparatorTemplate>
                                            <tr height="1">
                                                <td colspan="11" style="padding: 0;">
                                                    <img height="1" src="images/sep.gif" width="100%" /></td>
                                            </tr>
                                        </SeparatorTemplate>
                                        <FooterTemplate>
                                            <tr height="48">
                                                <td colspan="12">
                                                    <img src="images/spacer.gif" width="100%" height="1" /></td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" align="right">
                                                    <b>Total</b></td>
                                                <td class="blueL" align="center">
                                                    <%=proposalSummary.totalCosts.ToString("#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="blueL" align="center">
                                                    <%=proposalSummary.totalCont.ToString("#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=proposalSummary.totalAdhoc.ToString("#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="blueL" align="center">
                                                    <%=proposalSummary.totalSR.ToString("#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=proposalSummary.totalCR.ToString("#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" align="right">
                                                    <!-- onmouseover="highlight(this.parentNode)" onmouseout="clearHighlight(this.parentNode)"-->
                                                    <b>Year end Mthly Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=String.Format("{0:#,##0}", (proposalSummary.totalCosts / 12))%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td align="center">
                                                    <b>Cont</b></td>
                                                <td align="center">
                                                    <b>Adhoc</b></td>
                                                <td>
                                                    &nbsp;</td>
                                                <td align="center">
                                                    <b>SR</b></td>
                                                <td align="center">
                                                    <b>CR</b></td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" align="right">
                                                    <b>#Prop</b></td>
                                                <td class="orange" align="center">
                                                    <%=proposalSummary.countAll.ToString("#,##0")%>
                                                </td>
                                                <td nowrap>
                                                    <b>Mth Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalCont, proposalSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalAdhoc, proposalSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td nowrap>
                                                    <b>Mth Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalSR, proposalSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalCR, proposalSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" align="right">
                                                    <b>Avg Prop Value</b></td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(proposalSummary.totalCosts, proposalSummary.countAll, "#,##0")%>
                                                </td>
                                                <td align="center" class="orange">
                                                    <%=String.Format("{0:#,##0}", (proposalSummary.totalCont / 12) + (proposalSummary.totalAdhoc / proposalSummary.currentMonth))%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=String.Format("{0:#,##0}", (proposalSummary.totalCont / 12))%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalAdhoc, proposalSummary.currentMonth, "#,##0")%>
                                                </td>
                                                <td align="center" class="orange">
                                                    <%=String.Format("{0:#,##0}", proposalSummary.MthAv)%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalSR, proposalSummary.currentMonth, "#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(proposalSummary.totalCR, proposalSummary.currentMonth, "#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td colspan="4">
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", proposalSummary.countCont)%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", proposalSummary.countAdhoc)%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", proposalSummary.countSR)%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", proposalSummary.countCR)%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            </table>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                </td>
                                <td width="20">
                                    <img src="images/spacer.gif" width="20" height="1" /></td>
                                <td valign="top">
                                    <asp:Repeater ID="rptProjects" runat="server" OnItemDataBound="rptProposals_ItemDataBound">
                                        <HeaderTemplate>
                                            <table class="data" border="0" cellspacing="0" cellpadding="5">
                                                <tr>
                                                    <td colspan="11"><b class="fldNote">Confirmed Projects</b></td>
                                                </tr>
                                                <tr class="header">
                                                    <td align="center">No</td>
                                                    <td>Client Name</td>
                                                    <td>Job Name</td>
                                                    <td align="center">Value</td>
                                                    <td align="center">CODE</td>
                                                    <td align="center">Type</td>
                                                    <td align="center">Cont</td>
                                                    <td align="center">Adhoc</td>
                                                    <td align="center">Type</td>
                                                    <td align="center">SR</td>
                                                    <td align="center">CR</td>
                                                </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# render_rptProjects((RepeaterItem)Container) %>
                                        </ItemTemplate>
                                        <SeparatorTemplate>
                                            <tr height="1">
                                                <td colspan="11" style="padding: 0;">
                                                    <img height="1" src="images/sep.gif" width="100%" /></td>
                                            </tr>
                                        </SeparatorTemplate>
                                        <FooterTemplate>
                                            <tr height="48">
                                                <td colspan="11">
                                                    <img src="images/spacer.gif" width="100%" height="1" /></td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" align="right">
                                                    <b>Total</b></td>
                                                <td class="blueL" align="center">
                                                    <%=projectSummary.totalCosts.ToString("#,##0") %>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="blueL" align="center">
                                                    <%=projectSummary.totalCont.ToString("#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=projectSummary.totalAdhoc.ToString("#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="blueL" align="center">
                                                    <%=projectSummary.totalSR.ToString("#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=projectSummary.totalCR.ToString("#,##0")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" align="right">
                                                    <b>Year end Mthly Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=String.Format("{0:#,##0}", (projectSummary.totalCosts / 12))%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td align="center">
                                                    <b>Cont</b></td>
                                                <td align="center">
                                                    <b>Adhoc</b></td>
                                                <td>
                                                    &nbsp;</td>
                                                <td align="center">
                                                    <b>SR</b></td>
                                                <td align="center">
                                                    <b>CR</b></td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" align="right">
                                                    <b>#Projects</b></td>
                                                <td class="orange" align="center">
                                                    <%=projectSummary.countAll.ToString("#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td nowrap>
                                                    <b>Mth Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalCont, projectSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalAdhoc, projectSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td nowrap>
                                                    <b>Mth Av</b></td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalSR, projectSummary.totalCosts, "#0%")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalCR, projectSummary.totalCosts, "#0%")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" align="right">
                                                    <b>Avg Project Value</b></td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.totalCosts, projectSummary.countAll, "#,##0")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td align="center" class="orange">
                                                    <%=String.Format("{0:#,##0}", (projectSummary.totalCont / 12) + (projectSummary.totalAdhoc / projectSummary.currentMonth))%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=String.Format("{0:#,##0}", (projectSummary.totalCont / 12))%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalAdhoc, projectSummary.currentMonth, "#,##0")%>
                                                </td>
                                                <td align="center" class="orange">
                                                    <%=String.Format("{0:#,##0}", projectSummary.MthAv)%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalSR, projectSummary.currentMonth, "#,##0")%>
                                                </td>
                                                <td class="blueL" align="center">
                                                    <%=DivisionOf(projectSummary.totalCR, projectSummary.currentMonth, "#,##0")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" align="right">
                                                    <b>Hit Rate</b></td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.countAll, proposalSummary.countAll, "#0%")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", projectSummary.countCont)%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", projectSummary.countAdhoc)%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.MthAv, proposalSummary.MthAv, "#0%")%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", projectSummary.countSR)%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=String.Format("{0:#,##0}", projectSummary.countCR)%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="3">
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.countCont, proposalSummary.countCont, "#0%")%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.countAdhoc, proposalSummary.countAdhoc, "#0%")%>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.countSR, proposalSummary.countSR, "#0%")%>
                                                </td>
                                                <td class="orange" align="center">
                                                    <%=DivisionOf(projectSummary.countCR, proposalSummary.countCR, "#0%")%>
                                                </td>
                                            </tr>
                                            </table>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    &nbsp;</td>
                            </tr>
                            <tr height="51">
                                <td>
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                        </div>
                        <br />
					</td>
				</tr>
			</table>
			</form>
			
		</td>
		
		<td width="6" class="rightShadow" valign="top">
			<img src="images/white.gif" width="6" height="6" /></td>
	</tr>
	
	<!-- bottom shadow -->
	<tr>
		<td height="6" class="bottomShadow" >
			<img src="images/white.gif" width="6" height="6" /></td>
		
		<td width="6" height="6">
			<img src="images/shadow_corner.gif" width="6" height="6" /></td>
	</tr>
</table>

</body>
</html>
